package com.sntk.organauthomanager.application.dto;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.sntk.organauthomanager.infrastructure.validation.Update;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @ClassName: RoleDTO
 * @author: wgchao
 * @createTime: 2020/7/21 3:38 PM
 * @Description: TODO
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(content = JsonInclude.Include.NON_NULL)
@JsonAutoDetect(getterVisibility = JsonAutoDetect.Visibility.PUBLIC_ONLY)
public class RoleDTO implements Serializable {

    @NotNull(message = "ID缺失", groups = Update.class)
    private Long id;

    //机构编号
    @NotBlank(message = "所属机构编号缺失", groups = Update.class)
    private String institutionNumber;

    //角色码
    @NotBlank(message = "角色码缺失", groups = Update.class)
    private String roleCode;

    //角色名
    @NotBlank(message = "角色名称缺失", groups = Update.class)
    private String roleName;

    //备注
    private String remark;

    @NotNull(message = "禁用状态缺失", groups = Update.class)
    private boolean disabled;

    private Boolean del;

    private Date createTime;

    private String creator;

    private Date lastUpdateTime;

    private String lastUpdator;


    //乐观锁 ObjectOptimisticLockingFailureException异常
    @NotNull(message = "版本号缺失", groups = Update.class)
    private Long version;
}
